classdef ziAuxInPort < MeasurementComponent.MachineUnit.IOPort.InputPort
    %ZIAUXINPORT �˴���ʾ�йش����ժҪ
    %   �˴���ʾ��ϸ˵��
    
    properties
        index
    end
    
    methods
        function obj = ziAuxInPort(device, index)
            p=inputParser;
            p.addRequired('device', @(x) isa(x, 'EquipmentControl.ZI.ziMFLI'));
            p.addRequired('index', @(x) ismember(Miscellaneous.ziIndexStr(x), {'0', '1'}));
            p.parse(device, index);
            
            name = ['AuxIn' Miscellaneous.ziIndexStr(index)];
            obj@MeasurementComponent.MachineUnit.IOPort.InputPort(device, name);
            
            obj.index = Miscellaneous.ziIndexStr(index);
            obj.getCurrentSetting();
        end
        
        %%
        function setting = getCurrentSetting(obj)
            zi = obj.device;
            setting.value = zi.getAuxInValue(Miscellaneous.ziIndexStr(obj.index));
            obj.current_setting = setting;
        end
        function obj = recoverLastSetting(obj)
        end
        function obj = setup(obj, varargin)
        end
        function obj = initialize(obj)
            obj.last_setting = obj.getCurrentSetting();
            obj.current_setting = obj.getCurrentSetting();
        end
        
        %%
        function node = getScopeNode(obj)
            node = ziScopeInput.(sprintf('AuxIn%d', Miscellaneous.ziIndexNum(obj.index)));
        end
    end
end

